package com.sibu.yx.promotion.admin.web.support.filter;

import org.apache.shiro.util.ThreadContext;
import org.apache.shiro.web.servlet.OncePerRequestFilter;
import org.springframework.core.annotation.Order;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author     ：yuwenbo
 * @date       ：Created in 2019/4/15 17:59
 * @description：用户登陆信息初始化
 */
//@Configuration
@WebFilter(urlPatterns = "/*",filterName = "用户初始化拦截器")
@Order(Integer.MAX_VALUE)
@Deprecated
public class TokenInitFilter extends OncePerRequestFilter {

    @Override
    protected void doFilterInternal(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        TokenSubject tokenUidSubject=new TokenSubject((HttpServletRequest)request);
        ThreadContext.bind(tokenUidSubject);
        chain.doFilter(request,response);
    }
}
